package com.emily.test.service.impl;

import com.emily.test.mapper.TRoleMenuMapper;
import com.emily.test.model.TRoleMenu;
import com.emily.test.service.TRoleMenuService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * @author ：zc
 * @date ：Created in 2019/4/4 11:05
 * @description：
 */
@Service
public class TRoleMenuServiceImpl implements TRoleMenuService {
    @Resource
    private TRoleMenuMapper tRoleMenuMapper;
    @Override
    @Transactional(propagation = Propagation.REQUIRED,isolation = Isolation.DEFAULT,timeout=36000,rollbackFor=Exception.class)
    public int insert(TRoleMenu tRoleMenu) {
        return tRoleMenuMapper.insertSelective(tRoleMenu);
    }

    @Override
    public List<Map<String, Object>> getMenuListByRoleIds(List<Integer> roleIds) {
        return tRoleMenuMapper.getMenuListByRoleIds(roleIds);
    }

    @Override
    public int insertRoleMenusInfo(Map<String, Object> map) {
        return tRoleMenuMapper.insertRoleMenusInfo(map);
    }

    @Override
    public int delete(Integer roleId) {
        return tRoleMenuMapper.delete(roleId);
    }

    @Override
    public int deleteByRoleIdList(List<Integer> roleIdList) {
        return tRoleMenuMapper.deleteByRoleIdList(roleIdList);
    }
}
